package 代码记录.指定公司代码练习记录.西安.分值100分;

import java.util.Scanner;

/**
 * @author zx
 * @create 2023-07-04 21:00
 * 没做出来
 */
public class 出错的或电路 {//26应该不常考吧
    /**
     * 人家的思路看不懂
     */
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();

        String str1 = scanner.nextLine();
        String str2 = scanner.nextLine();

        int count1 = countSum(str1, "1");
        int count0 = countSum(str2, "0");
        int count01 = 0;
        for (int i = 0; i < n; i++) {
            if (str2.charAt(i) == '0' && str1.charAt(i) == '1') {
                count01++;
            }
        }
        //这块也没看懂
        int res = (count1 - count01) * (count0 - count01) + (n - count1) * count01;
        System.out.println(res);
    }

    /**
     * @return 这个方法没看懂
     */
    private static int countSum(String str, String i) {
        int count = 0;
        int index = 0;
        while ((index = str.indexOf(i, index)) != -1) {
            count++;
            index += i.length();
        }
        return count;
    }
    /**
     * 自己的思路，但不对
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        String str = "";
        for(int i = 0;i < n;i++){
            int c1 = str1.charAt(i) - '0';
            int c2 = str2.charAt(i) - '0';
            str += (c1 | c2);
        }
        int count = 0;
        for(int i = 0;i < n;i++){
            for(int j = 1;j < n;j++){
                String temp = helper(str1,str2,i,j);
                if(!str.equals(temp)){
                    count++;
                }
            }
        }
        System.out.println(count);
    }

    private static String helper(String str1, String str2, int i, int j){
        String res = "";
        char c1 = str1.charAt(i);
        char c2 = str2.charAt(j);
        String temp1 = str1.substring(0,i);
        String temp2 = str1.substring(i + 1,j);
        String temp3 = str1.substring(j);
        str1 = temp1 + c2 + temp2 + c1 + temp3;
        for(int k = 0;k < str2.length();k++){
            int a1 = str1.charAt(k) - '0';
            int a2 = str2.charAt(k) - '0';
            res += (a1 | a2);
        }
        return res;
    }
}
